var app = getApp();
var util = require('../../../utils/util.js');

Page({
    data: {
        orderId: "",
        orderType: "",
        rule:""
    },
    onLoad: function (e) {
        var that = this;
        that.setData({
            navH: app.globalData.navHeight,
            orderId: e.orderId,
            orderType: e.orderType
        });
        that.getOrderDet();
    },
    navBack: function () {
        wx.navigateBack({
            delta: 1
        })
    },
    getOrderDet: function () {
        var that = this;
        wx.request({
            url: app.globalData.apiHost + "/api/order/orderDetails",
            data: {
                order_id: that.data.orderId,
                order_type: that.data.orderType
            },
            header: {
                'content-type': 'application/x-www-form-urlencoded',
                'Cookie': 'token=' + wx.getStorageSync('token')
            },
            method: "POST",
            dataType: "json",
            success: function (res) {
                if (res.statusCode === 200) {
                    var ruleData = util.baseDecode(res.data.data.goods_detail.rule);
                    that.setData({
                         rule:ruleData
                    })
                }
            },
            
        });
    }
})
